package com.yitiao.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;


@Service
@Slf4j
public class ArticleService {
    public static final String CACHE_ARTICLE ="article_";

    @Resource
    private StringRedisTemplate redisTemplate;

    public void likeArticle(String articleId) {
        Long increment = redisTemplate.opsForValue().increment(CACHE_ARTICLE + articleId,1);
        log.info("----------increment:{}",increment);
    }
}
